?rnorm
#### create control group 
d1 <- rnorm(5, mean = 55, sd = 2)
d2 <- rnorm(5, mean = 46, sd = 2)
d3 <- rnorm(5, mean = 40, sd = 2)
d4 <- rnorm(5, mean = 29, sd = 2)
d5 <- rnorm(5, mean = 14, sd = 2)
d1 <- as.data.frame(d1)
d2 <- as.data.frame(d2)
d3 <- as.data.frame(d3)
d4 <- as.data.frame(d4)
d5 <- as.data.frame(d5)

data <- cbind2(d1,d2)
data <- cbind2(data,d3)
data <- cbind2(data,d4)
data <- cbind2(data,d5)
data <- data %>% gather (
  x,y
)
data
data$z <- rep("control",25)
ctrl <- data
write.csv(ctrl, file = "control.csv")

#### create clp group 
d1 <- rnorm(5, mean = 53, sd = 2)
d2 <- rnorm(5, mean = 48, sd = 2)
d3 <- rnorm(5, mean = 42, sd = 2)
d4 <- rnorm(5, mean = 35, sd = 1.5)
d5 <- rnorm(5, mean = 13, sd = 2)
d1 <- as.data.frame(d1)
d2 <- as.data.frame(d2)
d3 <- as.data.frame(d3)
d4 <- as.data.frame(d4)
d5 <- as.data.frame(d5)

data <- cbind2(d1,d2)
data <- cbind2(data,d3)
data <- cbind2(data,d4)
data <- cbind2(data,d5)
data <- data %>% gather (
  x,y
)
data
data$z <- rep("CLP",25)
tst <- data
tst

write.csv(tst, file = "test.csv")

data <- rbind2(ctrl,tst)

cname <- c("time_point","value","group")
colnames(data)<- cname
data
data$value <- round(data$value)
write.csv(data, file = "CLP_latency_time.csv")
library("ggplot2")
library("plyr")
library("tidyverse")
cdata <- ddply(data, c("group", "time_point"), summarise,
               N    = length(value),
               mean = mean(value),
               sd   = sd(value),
               se   = sd / sqrt(N)
)
cdata
write.csv(cdata,file = "CLP_LAENTCY_STAT.CSV")









